#!/usr/local/bin/python3
# *_* coding: UTF-8 *_*
# @IDE: PyCharm
# @Version: Python3.97
# @Author: Kendrick.Kc
# @Email: 509556985@qq.com
# @File: settings.py
# @Inst: 配置文件
# @Time: 2023/6/26 16:05
# -----

# kendrick.kc.guan@mail.com 账户密钥 - 绑定IP
# api_key = "XLEaEt1nXGQiFmLTbelrjocVbiRPlqrBZupTrYOpNm3F5lys73RcTZbm18vpxNJh"
# secret_key = "pjV2JrBTYP8eZY1js0oLltUWC11QOIOOepKLTfjCLRJPRn0qBJtgNJtGUBbZeHvZ"

# 交易所密钥 - 未绑定IP
# api_key = "pqU8HL2wIBcRCutyXyNEf7ZeAY1fKfiXn4bInMjzTG5qr6LdXA0iv59xjJM6eteo"
# secret_key = "cLc7OFH4iiqhauXsr2FOVcTOzGAusLN1WDuvQgbJfRsUYLAOI8KERTV0BMlUTk7B"


import basic
from multiprocessing import cpu_count


class Parameter:
    """
    动态参数
    """
    set_inst = "BTC"  # 交易货币
    set_leverage = 100  # 杠杆倍数
    set_min_balance = 0.2   # % 账户低于百分之多少时，停止交易
    set_balance = 100  # 程序启动最低的余额数，单位U
    set_margin = 5  # 保证金百分比
    set_ema = 72  # EMA参数. 目前最优:72
    set_atr = 20  # ATR参数. 目前最优:20
    set_rsi = 12  # RSI参数. 目前最优:12
    set_rsi7 = 72  # RSI参数. 目前最优:72
    set_rsi2 = 22  # RSI参数. 目前最优:22
    set_atr_multiple = 0.1  # ATR倍数. 目前最优:0.1

    """
    固定参数类
    """

    # 交易规则参数
    interval = 15     # K线时间周期 (仅限分钟级(m))
    isolated = "ISOLATED"  # 逐仓模式
    ccy = "USDT"  # 计价货币
    symbol = f"{set_inst}{ccy}"
    this_min_qty = None  # 订单最小数量限制
    this_price_decimal = None  # 价格小数点位数
    this_decimal = None  # 下单数量小数点位数
    this_min_notional = None  # 最小下单金额(交易所最小下单价格时5U)
    commission = 0.0004  # 手续费

    # DB参数
    db_coll = f"{basic.Exchange.binance}_{basic.Strategy.era}_balance"  # 账户可用余额
    db_coll_up = f"{basic.Exchange.binance}_{basic.Strategy.era}_up"  # 记录上一次结算后的账户可用余额
    db_coll_init = f"{basic.Exchange.binance}_{basic.Strategy.era}_init_balance"  # 初始余额
    db_coll_timeStamp = f"{basic.Exchange.binance}_{basic.Strategy.era}_time_stamp"  # 时间戳
    db_coll_side = "side"  # 持仓方向
    db_coll_price = "price"  # 开仓价格
    db_coll_pos = "pos_number"  # 仓位数量
    db_coll_program = "program"  # 自动停止程序的数据表 # 只平仓不开仓
